﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PrintDivisible7and3
{
    class PrintDivisible7and3
    {
        static void Main()
        {
            int[] array = new int[50];

            for (int i = 0; i < array.Length; i++)
            {
                array[i] = i;
            }

            var numbersLinQ =
                from number in array
                where number % 7 == 0 && number % 3 == 0
                select number;

            Console.WriteLine("divisible by 7 and 3");
            foreach (var number in numbersLinQ)
            {
                Console.WriteLine(number);
            }

            //Select divisible numbers using Lambda Expression

            var numbersLambda = array
                .Where(x => x % 7 == 0 && x % 3 == 0)
                .Select(x => x);

            Console.WriteLine("divisible by 7 and 3");
            foreach (var number in numbersLambda)
            {
                Console.WriteLine(number);
            }
            Console.WriteLine();
        }
    }
}
